Release 10.1A: OpenEdge Development:
Debugging and Troubleshooting


Starting Query Info logging

To create Query Info log entries, use the Log Entry Types (-logentrytypes) startup parameter or, for the AppServer and WebSpeed, the srvrLogEntryTypes property in the ubroker.properties file. Specify the QryInfo log entry type alone or in a comma-separated list that includes other log entry types. For example:

-logentrytypes QryInfo 
-logentrytypes QryInfo,ProEvents.UI.Command  

You also can turn on this logging at run time, using the LOG-MANAGER system handle. For example, you can include the following line in the 4GL code:

LOG-MANAGER:LOG-ENTRY-TYPES = "QryInfo:3" 

You can turn off this logging in the 4GL application by resetting the attribute. For example:

LOG-MANAGER:LOG-ENTRY-TYPES = ? 

Whichever way you start Query Info logging, you must do so before the query starts, or else no logging will occur for this query. If you turn off Query Info logging before the query completes, no logging will occur for this query.

Starting Query Info logging on individual queries

You can turn on Query Info logging programmatically for an individual query by doing the following:

If the query has already started, no Query Info logging occurs.

Upon successful startup, OpenEdge writes a message to the log file noting that it has turned on Query Info logging for the query; the message includes a Query ID, handle, and query name.

To turn off Query Info logging for the query, set the BASIC-LOGGING attribute of the query object handle to FALSE. If you do this before the query completes, no query statistics are written. OpenEdge writes a message to the log file noting that it has turned off Query Info logging for the query; the message includes a Query ID, handle, and query name.

Writing query statistics on-demand

You can write the currently accumulated Query Info logging statistics on a query to the log before the query completes, by calling the DUMP-LOGGING-NOW( ) method of the query object handle.

When you call DUMP-LOGGING-NOW( ) for a pre-pass query, OpenEdge writes the second set of statistics to the log. OpenEdge writes the first set after it builds the result-list. For more information, see the "Query statistics for pre-pass queries" section.

The DUMP-LOGGING-NOW( ) method returns TRUE if OpenEdge successfully writes the statistics to the log file; FALSE otherwise. Logging will fail, for example, if Query Info logging is turned off (for the individual query or in general), or if the query started before Query Info logging was turned on.

The syntax for the DUMP-LOGGING-NOW( ) method is:

query-handle:DUMP-LOGGING-NOW(reset) 

The DUMP-LOGGING-NOW() method takes an optional logical argument that, if set to TRUE, resets the query’s statistics to zero after writing to the log. FALSE is the default. In either case, statistics continue to accumulate as the query completes.

The following example writes to the log file after each result and resets the accumulated values:

DEFINE VARIABLE qh AS HANDLE NO-UNDO. 
CREATE QUERY qh. 
qh:SET-BUFFERS(BUFFER customer:HANDLE). 
qh:QUERY-PREPARE("for each customer where customer.cust-num < 5"). 
qh:QUERY-OPEN(). 
REPEAT: 
  qh:GET-NEXT(). 
  IF qh:QUERY-OFF-END THEN LEAVE. 
  qh:DUMP-LOGGING-NOW(TRUE). 
END. 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095